import { request } from '@umijs/max';

export async function getTodayData(
  params: {
    [key: string]: any
  },
  options?: { [key: string]: any },
) {
  return request<{
    code?: number;
    msg?: string;
    data?: Record<string, any>;
  }>('/extra-server/api/v1/user_log/today_data', {
    params,
    ...(options || {}),
  });
}


export async function getFlowStat(
  params: {
    [key: string]: any
  },
  options?: { [key: string]: any },
) {
  return request<{
    code?: number;
    msg?: string;
    data?: Record<string, any>;
  }>('/extra-server/api/v1/user_log/flow_stat', {
    params,
    ...(options || {}),
  });
}


export async function productDataAnalysis(
  params: {
    [key: string]: any
  },
  options?: { [key: string]: any },
) {
  return request<{
    code?: number;
    msg?: string;
    data?: Record<string, any>;
  }>('/extra-server/api/v1/user_log/product_data_analysis', {
    params,
    ...(options || {}),
  });
}



export async function deviceTypeCount(
  params: {
    [key: string]: any
  },
  options?: { [key: string]: any },
) {
  return request<{
    code?: number;
    msg?: string;
    data?: Record<string, any>;
  }>('/extra-server/api/v1/user_log/device_type_count', {
    params,
    ...(options || {}),
  });
}

export async function dateCount(
  params: {
    [key: string]: any
  },
  options?: { [key: string]: any },
) {
  return request<{
    code?: number;
    msg?: string;
    data?: Record<string, any>;
  }>('/extra-server/api/v1/apply/date_count', {
    params,
    ...(options || {}),
  });
}

export async function regionCount(
  params: {
    [key: string]: any
  },
  options?: { [key: string]: any },
) {
  return request<{
    code?: number;
    msg?: string;
    data?: any[];
  }>('/extra-server/api/v1/user_log/region_count', {
    params,
    ...(options || {}),
  });
}


export async function applyPage(
  data: {
    [key: string]: any
  },
  options?: { [key: string]: any },
) {
  return request<{
    code?: number;
    msg?: string;
    data?: any;
  }>('/extra-server/api/v1/apply/page', {
    data,
    method: 'POST',
    ...(options || {}),
  });
}

export async function userLogPage(
  data: {
    [key: string]: any
  },
  options?: { [key: string]: any },
) {
  return request<{
    code?: number;
    msg?: string;
    data?: any;
  }>('/extra-server/api/v1/user_log/page', {
    data: {
      ...data,
      behaviorType: 'search'
    },
    method: 'POST',
    ...(options || {}),
  });
}
